package com.dy.lock.screen.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dy.lock.screen.dao.MerchantAddressDao;
import com.dy.lock.screen.pojo.MerchantAddress;
import com.dy.lock.screen.scoket.Head;
import com.dy.lock.screen.service.MerchantAddressService;

@Service("merchantAddressService")
public class MerchantAddressServiceImpl implements MerchantAddressService {

	@Resource(name = "merchantAddressDao")
	private MerchantAddressDao merchantAddressDao;

	@Override
	public List<MerchantAddress> queryByMerchantId(String merhcantId, Head head) {
		// TODO Auto-generated method stub
		return merchantAddressDao.queryByMerchantId(merhcantId);
	}

	@Override
	public List<MerchantAddress> getNearestMerchantAddress(String goodsId,
			Float sourceLat, Float sourceLng) {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("goodsId", goodsId);
		paramMap.put("sourceLat", sourceLat);
		paramMap.put("sourceLng", sourceLng);
		return merchantAddressDao.queryNearestMerchant(paramMap);
	}

	@Override
	public Integer queryCountByMerchantId(String merhcantId, Head head) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("merchantId", merhcantId);
		return merchantAddressDao.queryCount(paramMap);
	}

}
